﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Unicode;
using System.Threading.Tasks;

namespace AutomaticPush.Common
{
    /// <summary>
    /// 应用全局缓存
    /// </summary>
    public class GlobalData
    {
        /// <summary>
        /// 程序集
        /// </summary>
        public List<Assembly> AllAssembly { get; set; }

        public string PushInfo { set; get; }

        public static bool PushState { set; get; }

        public static JsonSerializerOptions DefaultJsonOption
        {
            get
            {
                return new JsonSerializerOptions()
                {
                    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
                    PropertyNameCaseInsensitive = true,
                    //重新编码，解决中文乱码问题
                    Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
                };

            }
        }

        public static JsonSerializerOptions DefaultPostJsonOption
        {
            get
            {

                return new JsonSerializerOptions()
                {
                    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
                    PropertyNameCaseInsensitive = true,
                    //重新编码，解决中文乱码问题
                    Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
                };

            }
        }
    }
}
